#ifndef LOLTIMER_H
#define LOLTIMER_H

#include <QObject>
#include <QResource>
#include <QString>
#include <QList>
#include <QTimer>
#include <QEventLoop>
//#include "Client.h"
#include "mainwindow.h"
#include "Settings.h"
#include "CheckProcess.h"
#include "OverlayWindow.h"




class LolTimer : public QObject
{
    Q_OBJECT
public:
    explicit LolTimer(MainWindow * window, QObject * parent = 0);
    ~LolTimer();

    /*
     *  Main function of the class, start with the start signal
     */
    void start();

    /*
     *  Sleep function
     *  @param unsigned long msecs : Time in millisseconds to sleep
     */
    void msleep(unsigned long msecs);


    /*
     *  Start the process check thread
     */
    void startProcessCheck();


    /*
     *  Stop the process check thread
     */
    void stopProcessCheck();


    /*
     *  Open the overlay window
     */
    void openOverlayWindow();


    /*
     *  Close the overlay window
     */
    void closeOverlayWindow();

    /*
     *  Initialize the options and set the true values in the UI options tab
     */
    void initOptions();

    /*
     *  Change the option value "ReadTimeout" (time between each process scan)
     */
    void changeReadTimeout(int selectedTimeout);
private:
    MainWindow * window;                //Pointer to the mainWindow
    Settings * settings;                //pointer to the settings
    CheckProcess * checkProcess;        //Pointer to the check process thread
    OverlayWindow * overlayWindow;      //pointer to the overlay window

signals:
    void signalSleepEnd();
    void signalSetStatusBar(QString text, int time = 100000);

public slots:
    void slotStart();
    void slotForceStartOverlay();
    void slotForceStopOverlay();
    void slotChangeReadTimout(int  selectedTimeout);
    void slotProcessStarted(Process * process);
    void slotProcessStopped(Process * process);
    void slotChangeBackground(bool);
    void slotChangeFading(bool);

};

#endif // LOLTIMER_H
